package com.nekonomics
package domain.validation

import error.ParamError
import error.ParamError.InvalidParam

import zio.ZIO

object RequestValidator {
  
  def checkPageReq(pageNum: Int, pageSize: Int): ZIO[Any, ParamError, Option[Nothing]] =
    ZIO.fail(InvalidParam("pageNum和pageSize不能小于1")) when pageNum < 1 || pageSize < 1
  
  def checkList[T](fieldName: String, list: List[T]): ZIO[Any, ParamError, Option[Nothing]] = {
    ZIO.fail(InvalidParam(s"字段${fieldName}数据为空")) when list.isEmpty
  }



}
